package com.example.replacebooks.mapper;

import com.example.replacebooks.entity.Bookorder;
import com.example.replacebooks.entity.Orders;
import com.example.replacebooks.entity.Params;
import com.example.replacebooks.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

@Repository
public interface BookorderMapper extends Mapper<Bookorder> {
    List<Bookorder> findBySearch(@Param("params") Params params,@Param("userid") Integer userid, @Param("name") String name ,@Param("role") Integer role);

    @Select("select * from bookorder where bookorderid = #{bookorderid} limit 1")
    Bookorder findByBookOrderid(@Param("bookorderid") Integer bookorderid);

    @Update("update bookorder set no = #{no},userid = #{userid},totalprice = #{totalprice},bookname = #{bookname},consigname= #{consigname},consigphone=#{consigphone},address = #{address},time = #{time},state = #{state},paytime = #{paytime} where bookorderid = #{bookorderid}")
    void updateByBookorderid(Bookorder bookorder);

    List<Bookorder> findByStatuSearch(@Param("params") Params params,@Param("userid") Integer userid, @Param("name") String name ,@Param("role") Integer role);
}

